package com.sumainfor.zuul.controller;

import com.sumainfor.common.util.FieldCheckUtil;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.zuul.service.GetterMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author Eddy·Chen
 * @Email 835033913@qq.com
 * @Create 2019-04-17 18:08
 * 获取消息通知
 */
@RestController
@RequestMapping("/sys/getMessage")
public class GetterMessageController {

    @Autowired
    private GetterMessageService gms;


    /**
     * 查询消息
     *
     * @param params
     * @return
     */
    @RequestMapping("/getMessage")
    public JsonResult getMessage(@RequestParam Map<String, Object> params) {
        if (!FieldCheckUtil.isMapFieldNotNull(params, "type")) {
            return JsonResult.errorForEmpty();
        }
        return gms.getMessage(params);
    }

}
